<template>
  <transition name="pop">
    <span class="bubble-base">{{ showNum }}</span>
  </transition>
</template>
<script lang="ts">
import Vue from "vue";
export default Vue.extend({
  props: {
    showNum: {
      type: Number,
      required: true,
    },
  },
});
</script>
<style lang="stylus" scoped>
$height = 16px;
$width = 24px;
$bgc = rgb(240, 20, 20);
$font-color = white;
$font-size = 9px;
$font-weight = 700;

.bubble-base {
  display: inline-block; // inline-block
  box-sizing: border-box;
  text-align: center;
  width: $width;
  border-radius: 6px;
  background-color: $bgc;
  color: $font-color;
  font-size: $font-size;
  font-weight: $font-weight;
  line-height $height;
  box-shadow: 0 2px 4px 0px rgba(0, 0, 0, 0.4);
}

.pop-enter-active {
  animation: pop-out .2s;
}

.pop-leave-active {
  animation: pop-out .2s reverse;
}

// 跳入动画
@keyframes pop-out {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}
</style>
